#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char*argv[])
{
	FILE *fp=fopen(argv[2],"r");
	int len;
	char ch;
	len=atoi(argv[1]);
	int m=0;
	do{
		ch=fgetc(fp);
		if(ch=='\n')
			m++;
	}while(ch!=EOF);
	fclose(fp);

	int i=0;
	FILE *fp2=fopen(argv[2],"r");
	for(i;i<m;)
	{
		ch=fgetc(fp2);
		if(i>=m-len)
		{
			putchar(ch);
		}
		if(ch=='\n')
			i++;
	}
	fclose(fp2);
	return 0;
}
